<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>

<html class="app-ui">

<head>
    <!-- Meta -->
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />

    <!-- Document title -->
    <title>待审核商家申请</title>

    <meta name="description" content="AppUI - Admin Dashboard Template & UI Framework" />
    <meta name="author" content="rustheme" />
    <meta name="robots" content="noindex, nofollow" />

    <!-- Favicons -->
    <link rel="apple-touch-icon" href="${pageContext.request.contextPath}/assets/img/favicons/apple-touch-icon.png" />
    <link rel="icon" href="${pageContext.request.contextPath}/assets/img/favicons/favicon.ico" />

    <!-- Google fonts -->
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,400italic,500,900%7CRoboto+Slab:300,400%7CRoboto+Mono:400" />

    <!-- AppUI CSS stylesheets -->
    <link rel="stylesheet" id="css-font-awesome" href="${pageContext.request.contextPath}/assets/css/font-awesome.css" />
    <link rel="stylesheet" id="css-ionicons" href="${pageContext.request.contextPath}/assets/css/ionicons.css" />
    <link rel="stylesheet" id="css-bootstrap" href="${pageContext.request.contextPath}/assets/css/bootstrap.css" />
    <link rel="stylesheet" id="css-app" href="${pageContext.request.contextPath}/assets/css/app.css" />
    <link rel="stylesheet" id="css-app-custom" href="${pageContext.request.contextPath}/assets/css/app-custom.css" />
    <!-- End Stylesheets -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/js/layui/css/layui.css" media="all">
</head>

<body class="app-ui layout-has-drawer layout-has-fixed-header">
<div class="app-layout-canvas">
    <div class="app-layout-container">

        <!-- Drawer -->
        <aside class="app-layout-drawer">

            <!-- Drawer scroll area -->
            <div class="app-layout-drawer-scroll" style="margin-top: 50px;">
                <!-- Drawer logo -->
                <div id="logo" class="drawer-header" style="text-align: center;margin: 0 auto;font-family: 华文楷体; padding-top: 20px;">
                    <span style="font-size: 34px;"><strong>院校后台</strong></span>
                </div>

                <!-- Drawer navigation -->
                <nav class="drawer-main">
                    <ul class="nav nav-drawer">
                        <li class="nav-item nav-drawer-header">
                            <hr color="#ccc">
                        </li>

                        <li class="nav-item nav-item-has-subnav active open">
                            <a href="javascript:void(0)"><i class="ion-ios-compose-outline"></i> <span style="font-size: 20px;"> 商家申请</span></a>
                            <ul class="nav nav-subnav">

                                <li class="active">
                                    <a href="businessApplyNeedCheck.jsp"><span style="font-size: 16px;">待审核</span></a>
                                </li>

                                <li>
                                    <a href="businessApplyChecked.jsp"><span style="font-size: 16px;">已审核</span></a>
                                </li>
                            </ul>
                        </li>


                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="ion-ios-browsers-outline"></i><span style="font-size: 20px;"> 配送员申请</span></a>
                            <ul class="nav nav-subnav">

                                <li>
                                    <a href="deliveryManApplyNeedCheck.jsp"><span style="font-size: 16px;">待审核</span></a>
                                </li>

                                <li>
                                    <a href="deliveryManApplyChecked.jsp"><span style="font-size: 16px;">已审核</span></a>
                                </li>

                            </ul>
                        </li>

                    </ul>
                </nav>
                <!-- End drawer navigation -->
            </div>
            <!-- End drawer scroll area -->
        </aside>
        <!-- End drawer -->

        <!-- Header -->
        <header class="app-layout-header">
            <nav class="navbar navbar-default">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar-collapse"
                                aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <button class="pull-left hidden-lg hidden-md navbar-toggle" type="button" data-toggle="layout" data-action="sidebar_toggle">
                            <span class="sr-only">Toggle drawer</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="javascript:void(0)">
                            <img class="img-responsive" src="${pageContext.request.contextPath}/assets/img/logo/logo-frontend.png" title="强强组合商城" alt="AppUI" />
                        </a>
                    </div>

                    <div class="collapse navbar-collapse" id="header-navbar-collapse">
                        <!-- .navbar-left -->

                        <ul class="nav navbar-nav navbar-right navbar-toolbar hidden-sm hidden-xs">
                            <li class="active">
                                <a href="../home/frontend_home.jsp">商城首页</a>
                            </li>
                            <li class="active">
                                <a href="frontend_home.html"></a>
                            </li>
                            <li class="dropdown">
                                <a href="javascript:void(0)" data-toggle="dropdown"><i class="ion-ios-bell"></i> <span class="badge" style="background-color: red;">3</span></a>
                                <ul class="dropdown-menu dropdown-menu-right">
                                    <li>
                                        <a tabindex="-1" href="javascript:void(0)"><span class="badge pull-right" style="background-color: red;">2</span> 消息 </a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="javascript:void(0)"><span class="badge pull-right" style="background-color: red;">1</span> 通知 </a>
                                    </li>

                                </ul>
                            </li>

                            <li class="dropdown dropdown-profile">
                                <a href="javascript:void(0)" data-toggle="dropdown">
                                    <span class="m-r-sm">${account.accName} <span class="caret"></span></span>
                                    <img class="img-avatar img-avatar-48" src="${pageContext.request.contextPath}/file/acc/${account.accImg == null?"000000011612245316757212.png":account.accImg}" alt="User profile pic" />
                                </a>
                                <ul class="dropdown-menu dropdown-menu-right">

                                    <li>
                                        <a href="#" id="logout">退出</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <!-- .navbar-right -->
                    </div>
                </div>
                <!-- .container-fluid -->
            </nav>
            <!-- .navbar-default -->
        </header>
        <!-- End header -->

        <main class="app-layout-content">

            <!-- Page Content -->
            <div class="container-fluid p-y-md">
                <!-- Cards API, functionality initialized in App() -> uiCardsApi() -->
                <div class="row">

                    <div class="col-sm-12">
                        <div class="card">
                            <div class="card-block">

                                <div class="table-responsive">
                                    <%--渲染表格数据--%>
                                    <table class="layui-hide" id="demo" lay-filter="test"></table>
                                    <%--动态显示按钮--%> <%--d 对象是layui 内置的--%>
                                    <script type="text/html" id="barDemo">
                                       <%-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> &lt;%&ndash;绿色&ndash;%&gt;--%>
                                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">不通过</a> <%--红色--%>
                                        <%--<a class="layui-btn layui-btn-warm layui-btn-xs no" lay-event="no">轮播隐藏</a>--%> <%--黄色--%>
                                        <a class="layui-btn layui-btn-normal layui-btn-xs yes" lay-event="yes">通过</a> <%--蓝色--%>
                                    </script>
                                </div>
                                <!-- .table-responsive -->
                            </div>
                        </div>
                    </div>
                    <!-- .col-sm-12 -->
                </div></div>
                <!-- .row -->
        </main>

    </div>
    <!-- .app-layout-container -->
</div>
<!-- .app-layout-canvas -->

<div class="app-ui-mask-modal"></div>

<!-- AppUI Core JS: jQuery, Bootstrap, slimScroll, scrollLock and App.js -->
<script src="${pageContext.request.contextPath}/assets/js/core/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/core/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/core/jquery.slimscroll.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/core/jquery.scrollLock.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/core/jquery.placeholder.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/app.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/app-custom.js"></script>

<!-- Page Plugins -->
<script src="${pageContext.request.contextPath}/assets/js/plugins/slick/slick.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/plugins/chartjs/Chart.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/plugins/flot/jquery.flot.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/plugins/flot/jquery.flot.pie.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/plugins/flot/jquery.flot.stack.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/plugins/flot/jquery.flot.resize.min.js"></script>

<!-- Page JS Code -->
<%--<script src="${pageContext.request.contextPath}/assets/js/pages/index.js"></script>--%>

<script src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
<script src="${pageContext.request.contextPath}/js/layui/layui.js"></script>

<script type="text/javascript">
    $(function() {
        //院校id
        var schoolId = ${school.schoolId};

        layui.use(['laydate', 'table', 'carousel', 'upload'], function(){
            var laydate = layui.laydate //日期
                ,table = layui.table //表格
                ,carousel = layui.carousel //轮播
                ,upload = layui.upload //上传

            showTable();
            function showTable(){
                //执行一个 table 实例
                table.render({
                    elem: '#demo'
                    //    ,height: 500
                    ,url: "/school/businessApplyNeedCheck?schoolId="+schoolId //数据接口
                    ,title: '用户表'
                    ,page: true //开启分页
                    ,cols: [[ //表头
                        {field: 'numbers', title: '序号', width:80, type: 'numbers'}
                        ,{field: 'accId', title: '用户id', width:120, sort: true, hide:true}
                        ,{field: 'accName', title: '用户名', width:100}
                        ,{field: 'stuNo', title: '学号', width:150}
                        ,{field: 'accTruename', title: '姓名', width: 90, totalRow: true}
                        ,{field: 'accTelephone', title: '电话', width:150, }
                        ,{field: 'shopName', title: '店铺名称', width:120, }
                        ,{fixed: 'right', title: '操作', width: 165, align:'center', toolbar: '#barDemo'}  //toolbar 对应div的id
                    ]]
                    ,limits: [3,5,10]
                    ,limit: 5 //每页默认显示的数量
                });

            }

            //监听行工具事件（即操作）
            table.on('tool(test)', function(obj){ //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
                var data = obj.data //获得当前行数据
                    ,layEvent = obj.event; //获得 lay-event 对应的值
                if(layEvent === 'yes'){     //发货
                    layer.confirm('确定通过该商家申请吗？', function(index){
                        var param = {
                            accId:data.accId,
                            _method:'put'
                        }
                        var url = "/school/passBusinessApply";
                        $.post(url,param,function (res){
                            if(res.code == 1001){
                                layer.closeAll();   //关闭确定的提示弹窗
                                layer.open({
                                    type: 1    //类型设置为 1，表示弹出层弹出的内容是 string
                                    ,content: '<div style="padding: 20px 100px;">'+ res.message +'</div>'
                                    ,btn: '确定'
                                    ,btnAlign: 'c' //按钮居中
                                    ,shade: 0 //不显示遮罩
                                    ,yes: function(){
                                        //    layer.closeAll();
                                        top.location='businessApplyNeedCheck.jsp';  //刷新当前页面
                                    }
                                });
                            }else if(res.code == 1002){
                                layer.msg(res.msg);
                            }
                        })
                    });
                } else if(layEvent === 'del'){  //退款
                    layer.confirm('确定不通过该商家申请吗？', function(index){
                        //    obj.del(); //删除对应行（tr）的DOM结构
                        //    layer.close(index);
                        //向服务端发送删除指令
                        var param = {
                            accId:data.accId,
                            _method:'put'
                        }
                        var url = "/school/unPassBusinessApply";
                        $.post(url,param,function (res){
                            if(res.code == 1001){
                                layer.closeAll();   //关闭确定的提示弹窗
                                layer.open({
                                    type: 1    //类型设置为 1，表示弹出层弹出的内容是 string
                                    ,content: '<div style="padding: 20px 100px;">'+ res.message +'</div>'
                                    ,btn: '确定'
                                    ,btnAlign: 'c' //按钮居中
                                    ,shade: 0 //不显示遮罩
                                    ,yes: function(){
                                        //    layer.closeAll();
                                        top.location='businessApplyNeedCheck.jsp';  //刷新当前页面
                                    }
                                });
                            }else if(res.code == 1002){
                                layer.msg(res.msg);
                            }
                        })
                    });
                }

            });


        });


        /*退出登录*/
        $("#logout").click(function (event){
            event.preventDefault();
            var url = "/login/logoutShop";
            $.post(url,function (){
                window.location.href = "../../login.jsp";
            })
        })

    });
</script>

</body>

</html>
